//package com.pro.common.modules.service.dependencies.modelauth.base;
//
//import com.pro.common.api.dependencies.CommonConst;
//import com.pro.common.api.dependencies.enums.EnumSysRole;
//import com.pro.common.api.dependencies.service.IAuthRoleService;
//import com.pro.common.modules.service.dependencies.modelauth.base.model.LoginInfoDTO;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cache.annotation.Cacheable;
//import org.springframework.stereotype.Service;
//
//import java.util.Set;
//import java.util.stream.Collectors;
//
//@Service
//public class LoginInfoService {
//    @Autowired
//    private IAuthRoleService authRouteService;
//    @Autowired
//    private TokenService tokenService;
//
////    @CacheEvict(value = CommonConst.CacheKey.LoginInfo, key = "#role+'_'+#loginId")
////    public void clearCache(EnumSysRole role, String token) {
////
////    }
//
//    @Cacheable(value = CommonConst.CacheKey.LoginInfo, key = "#role+'_'+#Id")
//    public LoginInfoDTO getLoginInfoCache(EnumSysRole role, Long id) {
//        Set<String> permissionPaths = null;
//        Set<String> permissionPathsPrefix = null;
//        if (null != id) {
//            permissionPaths = authRouteService.getPath(role, id);
//            permissionPathsPrefix = permissionPaths.stream().filter(p -> p.endsWith("*")).map(u -> u.replaceAll("\\*+$", "")).collect(Collectors.toSet());
//            permissionPaths = permissionPaths.stream().filter(p -> !p.endsWith("*")).collect(Collectors.toSet());
//        }
//        return new LoginInfoDTO(role, id, permissionPaths, permissionPathsPrefix);
//    }
//}
